/**
 * JMPlurk, a Java Mobile client for Plurk
 * Copyright (C) 2009 Petra Barus
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package com.maleskoding.jmplurk.plurkapi;

import org.json.me.JSONException;
import org.json.me.JSONObject;

/**
 *
 * @author Petra Barus
 */
public class User extends JSONObject {

    public final String FIELD_ID = "id";
    public final String FIELD_NICK_NAME = "nick_name";
    public final String FIELD_HAS_PROFILE_IMAGE = "display_name";
    public final String FIELD_AVATAR = "avatar";
    public final String FIELD_LOCATIOn = "location";
    public final String FIELD_DATE_OF_BIRTH = "date_of_birth";
    public final String FIELD_FULL_NAME = "full_name";
    public final String FIELD_GENDER = "gender";
    public final String FIELD_PAGE_TITLE = "page_title";
    public final String FIELD_KARMA = "karma";
    public final String FIELD_RECRUITED = "recruited";
    public final String FIELD_RELATIONSHIP = "relationship";

    public User(String jsonstring) throws JSONException {
        super(jsonstring);
    }

    public User(JSONObject jsonobject) throws JSONException {
        super(jsonobject.toString());
    }

    public String getValue(String field) {
        try {
            return getString(field);
        } catch (JSONException ex) {
            return "";
        }
    }
}
